package aygx.spring.boot.principle.config;

import aygx.spring.boot.principle.service.impl.ScheduleServiceImpl;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;

/**
 * @author 暗影孤星
 * @date 2022/7/25 23:07
 * @description 通过BeanDefinition的注册器注册实名bean，实现对容器中bean的最终裁定
 */
public class MyPostProcessor implements BeanDefinitionRegistryPostProcessor {
    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
        registry.registerBeanDefinition("scheduleService", BeanDefinitionBuilder.rootBeanDefinition(ScheduleServiceImpl.class).getBeanDefinition());

    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {

    }

}